package Thread;

public class ThreadDemo11 {

    public static void main(String[] args) throws InterruptedException {
        Object object = new Object();
        Thread t1 = new Thread(()->{
            System.out.println("wait之前");
            try {
                synchronized (object) {
                    object.wait();
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("wait之后");
        });
        Thread t2 = new Thread(()->{
            System.out.println("notify之前");
            synchronized (object) {
                object.notify();
            }
            System.out.println("notify之后");
        });
        t1.start();
        Thread.sleep(500);
        t2.start();
    }

}
